#pragma once
#include<iostream>
#include <memory>
#include <assert.h>
#include<stdlib.h>
using namespace std;
#ifdef _ICONV_SUPPORT
#include <iconv.h>
#include <string.h>

#define CHARSET_GBK			"GBK"
#define CHARSET_UTF_8		"UTF-8"
#define CHARSET_UTF_16LE	"UTF-16LE"
//#define CHARSET_UTF_32LE	"UTF-32LE"
#define CHARSET_UTF_32LE	"UNICODE"
#define  ASSERT assert
#define FALSE 0
#define TRUE 1

typedef size_t					SIZE_T;
typedef ssize_t					SSIZE_T;
typedef char					CHAR, INT8;
typedef CHAR					*PCHAR, *LPCHAR, *PSTR, *LPSTR;
typedef wchar_t WCHAR;
typedef const char				*PCSTR, *LPCSTR;
typedef int BOOL;
BOOL CharsetConvert(LPCSTR lpszFromCharset, LPCSTR lpszToCharset, LPCSTR lpszInBuf, int iInBufLen, LPSTR lpszOutBuf, int& iOutBufLen);
#else
#include<windows.h>
#endif
	int CodePageToUnicode(int iCodePage, const char szSrc[], wchar_t szDest[], int & iDestLength);
	int UnicodeToCodePage(int iCodePage, const WCHAR szSrc[], char szDest[], int & iDestLength);
	int GbkToUnicode(const char szSrc[], WCHAR szDest[], int & iDestLength);
	int UnicodeToGbk(const WCHAR szSrc[], char szDest[], int & iDestLength);
	int Utf8ToUnicode(const char szSrc[], WCHAR szDest[], int & iDestLength);
	int UnicodeToUtf8(const WCHAR szSrc[], char szDest[], int & iDestLength);
	int GbkToUtf8(const char szSrc[], char szDest[], int & iDestLength);
	int Utf8ToGbk(const char szSrc[], char szDest[], int & iDestLength);

